package com.qiangesoft.bootcodegen.framework.listener;

import com.qiangesoft.bootcodegen.service.IBcgDataSourceService;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * 数据源初始化监听器
 * ps:容器初始化完成后
 *
 * @author qiangesoft
 * @date 2024-3-13
 */
@Component
@RequiredArgsConstructor
public class DataSourceInitListener implements ApplicationListener<ApplicationStartedEvent> {

    private final IBcgDataSourceService dataSourceService;

    @Override
    public void onApplicationEvent(ApplicationStartedEvent event) {
        dataSourceService.initDataSource();
    }

}
